home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
VRML 2.0 Sourcebook (2nd Edition)
/
VRML 2.0 Sourcebook CD [md5 fed90f4f9c39d5a60d477058775c7e21].iso
/
book
/
unix
/
ch09
/
09fig09.wrl
< prev
Wrap
Text File
|
1996-09-22
|
3KB
|
103 lines
#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright [1997] By
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
children [
# Lamp
DEF MoveLamp PlaneSensor { },
DEF Lamp Transform {
children [
# Lamp base
Shape {
appearance DEF White Appearance {
material Material { }
}
geometry Cylinder {
radius 0.1
height 0.01
}
},
# Base - First arm joint
Group {
children [
DEF MoveFirstArm SphereSensor {
offset 1.0 0.0 0.0 -0.7
},
DEF FirstArm Transform {
translation 0.0 0.15 0.0
rotation 1.0 0.0 0.0 -0.7
center 0.0 -0.15 0.0
children [
# Lower arm
DEF LampArm Shape {
appearance USE White
geometry Cylinder {
radius 0.01
height 0.3
}
},
# First arm - second arm joint
Group {
children [
DEF MoveSecondArm SphereSensor {
offset 1.0 0.0 0.0 1.9
},
DEF SecondArm Transform {
translation 0.0 0.3 0.0
rotation 1.0 0.0 0.0 1.9
center 0.0 -0.15 0.0
children [
# Second arm
USE LampArm,
# Second arm - shade joint
Group {
children [
DEF MoveLampShade SphereSensor {
offset 1.0 0.0 0.0 -1.25
},
DEF LampShade Transform {
translation 0.0 0.075 0.0
rotation 1.0 0.0 0.0 -1.25
center 0.0 0.075 0.0
children [
# Shade
Shape {
appearance USE White
geometry Cone {
height 0.15
bottomRadius 0.12
bottom FALSE
}
},
# Light bulb
Transform {
translation 0.0 -0.05 0.0
children Shape {
appearance USE White
geometry Sphere {
radius 0.05
}
}
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
ROUTE MoveLamp.translation_changed TO Lamp.set_translation
ROUTE MoveFirstArm.rotation_changed TO FirstArm.set_rotation
ROUTE MoveSecondArm.rotation_changed TO SecondArm.set_rotation
ROUTE MoveLampShade.rotation_changed TO LampShade.set_rotation